package detector;

import material.Material;
import commands.Command;

/**
 * Implementation de l'interface Checkable pour les boutons du clavier du metronome.
 */
public class CheckableButtonImpl implements Checkable {

	private int ID;				// Numero du bouton a verifier
	private Command command;	// Commande executee en cas de pression sur ce bouton

	public CheckableButtonImpl(int ID) {
		this.ID = ID;
	}
	
	public void setCommand(Command command) {
		this.command = command;
	}
	
	public void check() {
		if(Material.MaterialInstance().getKeyboard().isButtonPressed(ID)) {
			command.execute();
		}
	}
	
}
